package com.dc.refactoring._3_重新组织数据._7_ChangeBidirectionalAssociationToUnidirectional.step1;

import java.util.HashSet;
import java.util.Set;

/**
 * Description: 存在双向关联的 客户类
 * @author: gdc
 * @date: 2020/11/17
 * @version 1.0
 */
public class Customer {

    /**
     * 存在 Order 类的引用
     */
    private Set<Order> orders = new HashSet<>();

    Set<Order> friendOrders() {
        return orders;
    }

    public void addOrder(Order arg) {
        arg.setCustomer(this);
    }

    public double getDiscount() {
        return 0.88;
    }
}
